import React, { Component } from 'react'
import '../../less/index.less'
import AnswerUploadBox from './answer-upload-box'

export default class AnswerSubmitZipBox extends Component {
  uploadFileSuccess (fileInfo) {
    const {response} = fileInfo
    this.props.submitAnswer(response, null)
  }
  render () {
    const {userAnswerZipUrl} = this.props
    return <div className='margin-t-2 mark-down-wrap'>
      <div className='file-upload'>
        <AnswerUploadBox
          {...this.props}
          uploadFileSuccess={this.uploadFileSuccess.bind(this)}
          userAnswerZipUrl={userAnswerZipUrl}
        />
      </div>
      {this.props.needRunScript() ? this.props.getRunningResult() : ''}
    </div>
  }
}
